/* GUI CONVERTED from reoptrd.p (converter v1.75) Sat Aug 12 23:07:48 2000 */
/* reoptrd.p - DOWNTIME LABOR TRANSACTION BY PART (REPETITIVE)          */
/* Copyright 1986-2002 QAD Inc., Carpinteria, CA, USA.                  */
/* All rights reserved worldwide.  This is an unpublished work.         */
/*F0PN*/ /*V8:ConvertMode=Maintenance                                   */
/*K1Q4*/ /*V8:WebEnabled=No                                             */
/* REVISION: 5.0      LAST MODIFIED: 07/03/89   BY: emb      */
/* REVISION: 5.0      LAST MODIFIED: 10/17/90   BY: emb *B801*/
/* REVISION: 6.0      LAST MODIFIED: 08/09/91   BY: pma *D806*/
/* REVISION: 7.3      LAST MODIFIED: 03/01/93   BY: emb *G760*/


/* REVISION: 8.6E     LAST MODIFIED: 02/23/98   BY: *L007* A. Rahane */
/* REVISION: 8.6E     LAST MODIFIED: 05/20/98   BY: *K1Q4* Alfred Tan   */
/* REVISION: 8.6E     LAST MODIFIED: 10/04/98   BY: *J314* Alfred Tan   */
/* REVISION: 9.1      LAST MODIFIED: 08/12/00   BY: *N0KP* myb          */

/* ********** Begin Translatable Strings Definitions ********* */

{mfdeclre.i} /*GUI moved to top.*/
&SCOPED-DEFINE reoptrd_p_1 "Reason"
/* MaxLen: Comment: */

&SCOPED-DEFINE reoptrd_p_2 "Down Time"
/* MaxLen: Comment: */

&SCOPED-DEFINE reoptrd_p_3 "Input Total"
/* MaxLen: Comment: */

/* ********** End Translatable Strings Definitions ********* */

define shared variable wr_recno as recid.
define shared variable wc_recno as recid.
define shared variable op_recno as recid.

define shared variable ophist_recid as recid.
define shared variable pay_rate like emp_pay_rate.
define buffer ophist for op_hist.

define variable input_total as decimal format "->>9.999" label {&reoptrd_p_3}.
define shared variable downtime like input_total extent 5 label {&reoptrd_p_2}.
define shared variable down_rsn like rsn_code extent 5 label {&reoptrd_p_1}.
define variable i as integer.

/*GUI moved mfdeclre/mfdtitle.*/

     /* DOWNTIME TRANSACTIONS */
     find ophist no-lock where recid(ophist) = ophist_recid.
     do i = 1 to 2:

        if downtime[i] <> 0 or down_rsn[i] <> "" then do:

           create op_hist.

           {mfnoptr.i}

           assign
           op_hist.op_wo_nbr = ophist.op_wo_nbr
           op_hist.op_emp = ophist.op_emp
           op_hist.op_shift = ophist.op_shift
           op_hist.op_wo_op = ophist.op_wo_op
           op_hist.op_wo_lot = ophist.op_wo_lot
           op_hist.op_type = "DOWNTIME"
/*B801*/       op_hist.op_tran_date = today
/*G760*/       op_hist.op_site = ophist.op_site
/*G760*/       op_hist.op_line = ophist.op_line
/*G760*/       op_hist.op_milestone = ophist.op_milestone
           op_hist.op_wkctr = ophist.op_wkctr
           op_hist.op_mch = ophist.op_mch
           op_hist.op_date = ophist.op_date
           op_hist.op_part = ophist.op_part.
/*D806*/       op_hist.op_dept = ophist.op_dept.

           op_hist.op_rsn = down_rsn[i].
           op_hist.op_act_run = downtime[i].

           op_recno = recid(op_hist).
           {gprun.i ""reoptrc.p""}
/*GUI*/ if global-beam-me-up then undo, leave.


        end.
     end.
